//
//  WelcomeViewController.swift
//  WBDemo
//
//  Created by Jin on 07/05/2018.
//  Copyright © 2018 com.baidu.123. All rights reserved.
//

import UIKit
import SDWebImage

class WelcomeViewController: UIViewController {

    @IBOutlet var iconViewBottomCons: NSLayoutConstraint!
    @IBOutlet var iconView: UIImageView!
    
    override func viewDidLoad() {
        super.viewDidLoad()

        let account = UserAccount.loadUserAccount()
        
        //0.设置头像
        if let avatarStr = account?.avatar_large {
            iconView.sd_setImage(with: URL(string: avatarStr), placeholderImage: UIImage(named:"avatar_default_big"), options: [], completed: nil)
        }

        //1.改变约束值
        iconViewBottomCons.constant = UIScreen.main.bounds.height - 200
        UIView.animate(withDuration: 1.5, delay: 0.0, usingSpringWithDamping: 0.5, initialSpringVelocity: 10.0, options: UIViewAnimationOptions(rawValue: 0), animations: {
            self.view.layoutIfNeeded()
        }) { (_) in
            UIApplication.shared.keyWindow?.rootViewController = UIStoryboard(name: "Main", bundle: nil).instantiateInitialViewController()
        }
    }



}
